package com.eventx.service.redis;

import com.eventx.bus.channel.ChannelConfig;
import jdk.nashorn.internal.objects.annotations.Getter;
import jdk.nashorn.internal.objects.annotations.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;
import java.util.List;
import java.util.Properties;

/**
 * @author: anrror
 **/
@ConfigurationProperties(prefix = "spring.eventx.redis")
public class RedisChannelConfig extends ChannelConfig {

    private String host;
    private String auth;
    private Integer maxIdle;
    private Integer maxTotal;
    private String masterName;


    public RedisChannelConfig(Properties properties) {
        super(properties);
        this.host = properties.getProperty("host");
        this.auth = properties.getProperty("auth");
        this.maxIdle = Integer.valueOf(properties.getProperty("maxIdle","5"));
        this.maxTotal = Integer.valueOf(properties.getProperty("maxTotal","10"));
        this.masterName = properties.getProperty("masterName");
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getAuth() {
        return auth;
    }

    public void setAuth(String auth) {
        this.auth = auth;
    }

    public Integer getMaxIdle() {
        return maxIdle;
    }

    public void setMaxIdle(Integer maxIdle) {
        this.maxIdle = maxIdle;
    }

    public Integer getMaxTotal() {
        return maxTotal;
    }

    public void setMaxTotal(Integer maxTotal) {
        this.maxTotal = maxTotal;
    }

    public String getMasterName() {
        return masterName;
    }

    public void setMasterName(String masterName) {
        this.masterName = masterName;
    }
}
